package cn.thornbird.orgsync.vo.request;

import cn.thornbird.orgsync.constraints.FieldsValueMatch;
import cn.thornbird.orgsync.vo.record.SimpleUserRecord;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;

@Data
@FieldsValueMatch(first = "password", second = "confirmPassword", message = "两次密码输入应该一致")
public class ResetPasswordRequest {

    @NotBlank(message = "用户名不能为空")
    private String username;

    @NotBlank(message = "密码不能为空")
    @Size(min = 6, max = 16, message = "密码长度为6-16位")
    @Pattern(regexp = SimpleUserRecord.PASSWORD_REG_EXP, message = "密码必须包含数字，且必须包含字母或其它字符（!@_#$%^&*()-+=,.?）")
    private String password;

    @NotBlank(message = "确认密码不能为空")
    private String confirmPassword;

    @NotBlank(message = "验证码为必填项")
    @Pattern(regexp = SendVerificationCodeRequest.VERIFICATION_CODE_REG_EXP, message = "验证码不正确")
    private String verificationCode;

}
